class Websitestasks4Controller < ApplicationController
before_filter :authorize
    layout "page"
 
      active_scaffold :websitesinf do |config|
  config.label = "Websites List"
config.show.link.label = "Show Detail"  
config.show.link.type = :record
config.show.link.inline = true
  config.show.link.position = :after 
 config.actions.exclude :create,:update,:delete
 #   config.columns = [:name,:editorname1,:seditorname1]
  	  config.columns = [:name,:description1,:url1,:editorname1,:seditorname1,:mission1,:ecweekly1,:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user]	
  config.list.columns.exclude :description1, :url1, :mission1, :ecweekly1 	

# config.actions.swap :search, :live_search

		 config.columns[:name].label ="Website Name"
		 config.columns[:description1].label ="Website Description"
		 config.columns[:url1].label ="Website URL"
		 config.columns[:editorname1].label ="Name of Editor"	  	 
		 config.columns[:seditorname1].label ="Name of Sub Editor"
		 config.columns[:mission1].label ="Website mission"	  	 
		 config.columns[:ecweekly1].label ="Editors weekly comment"	


		 
    config.columns[:description1].form_ui = :textarea
    config.columns[:description1].options = {:rows => 90, :cols => 150}


    config.columns[:ecweekly1].form_ui = :textarea
    config.columns[:ecweekly1].options = {:rows => 90, :cols => 150}
    

    config.subform.columns.exclude :description1, :url1, :mission1, :ecweekly1

	

 config.action_links.add 'index', :label => 'Articles Report', :type => :record,:page=>true,:parameters =>{:controller=>'websitearticles3'}
    config.show.columns.exclude(:name,:editorname1,:seditorname1)       	
  config.show.label = "Show Detail"

# config.subform.columns = [:description1, :url1, :mission1, :ecweekly1] config.subform.columns = [:name1,:editorname1,:seditorname1]
		 
  end

  def show
  super
 # redirect_to  :controller => 'index'
 # return
    @websitesinf = Websitesinf.find(params[:id])
    @websitesinf.last_accessed_user = User.find(session[:user_id]).name
    @websitesinf.last_accessed_at = Time.now
    @websitesinf.save
   #  redirect_to  :controller => 'websitesinfs',:action=>'show'
  end


  def mytest
  @all_articles = Article.find(:all)
    @websitesinf = Websitesinf.find(params[:id])
  end
  
  def mytest1
    @websit=Websitesinf.find(params[:id])
    @myteststr = "Articles Report For Website "+@websit.name
    redirect_to :controller=>'websitearticles3',:action=>'index',:websiteid=>params[:id],:varaaa=>@myteststr
  end 
  
  def mytest2
    @websit=Websitesinf.find(params[:id])
    @myteststr = "Articles List For Website "+@websit.name
    redirect_to :controller=>'websitearticles2',:action=>'index',:websiteid=>params[:id],:varaaa=>@myteststr
  end    


end
